Fixed race condition when passing data to bgfx. Issue #1398#1628
Fixed race condition when passing data to bgfx. Issue #1398#1628bkaradzic-microsoft merged 2 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Addresses issue #1398 by reducing the chance of a use-after-free when uploading texture data to bgfx via bgfx::makeRef, ensuring CPU-side code doesn’t keep reading bimg::ImageContainer fields after bgfx may have triggered the release callback.
Changes:
- Cache
m_numMipsbefore mip iteration in 2D texture uploads to avoid reading from a potentially freedbimg::ImageContainer. - Cache
m_numMipsbefore mip iteration in cube texture uploads (single-image-per-face path). - Modify the cube-texture release callback condition to only free on the last face/last mip.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Change makes
imagepointer not being touched after passing data to bgfx.Alternative solution is to use
bgfx::copyinstead ofbgfx::makeRef.